package com.inool.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inool.common.result.Result;
import com.inool.model.Role;
import com.inool.service.RoleService;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "角色管理")
@RestController
@RequestMapping("/api/roles")
public class RoleController {

    @Autowired
    private RoleService roleService;
    @Operation(summary = "分页查询角色")
    @GetMapping("page")
    public Result<IPage<Role>> pageRoles(@RequestParam long current, @RequestParam long size) {
        IPage<Role> page = new Page<>(current, size);
        IPage<Role> list = roleService.pageRoles(page);
        return Result.ok(list);
    }
}
